#ifndef SOCKETMANGER_H
#define SOCKETMANGER_H

#include <QObject>

#include "Record.h"
#include "SocketClient.h"
#include "BaseGlobal.h"

class BASE_EXPORT SocketManger : public QObject
{
	Q_OBJECT

public:
	SocketManger(QObject *parent = 0);
	~SocketManger();

public:
	SocketClient * getStaticClient();

public:
	bool check(QString & Msg);
	bool exec(const QString & SQL, QString & Msg);
	bool select(const QString & SQL, QRecord & dsRecord, QString & Msg);

public slots:
	void onSocketDisconnected();

protected:
	void initData();
	void initSocketClient();

private:
	QRecord * pRecord;
	SocketClient * pSocketClient;

	static int iPort;
	static QHostAddress addrIP;
	static SocketClient * pStaticClient;
};

#endif // SOCKETMANGER_H
